<?php
require("include/top.php");	
$categories= Category::getAllCategory();
$tpl->assign ('categories',$categories);
if((isset($_POST['save_cat']))||(isset($_POST['save_subcat']))||(isset($_POST['save_subsubcat']))||(isset($_POST['save_modif']))) {
require(FORM_PATH."edit_categories.form.php");
}

if(isset($_GET['cat'])){
$cat=new Category($_GET['cat']);
$cat->load();
$tpl->assign('genre','category');
$tpl->assign('cat',$cat);
}
elseif (isset($_GET['subcat'])){
$cat=new Subcategory($_GET['subcat']);
$cat->load();
$tpl->assign('genre','subcategory');
$tpl->assign('subcategory',$cat);
}
elseif (isset($_GET['subsubcat'])){
$cat=new SubSubcategory($_GET['subsubcat']);
$cat->load();
$tpl->assign('genre','subsubcategory');
$tpl->assign('subsubcategory',$cat);
}



$tpl->display("header.tpl");
$tpl->display("menu.tpl");
$tpl->display("edit_categories.tpl");
$tpl->display("footer.tpl");



require('include/bottom.php');		
?>